package org.thomias.exo5.properties;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Properties;

public class PropertiesExample {

	public static void main(String[] args) {
		try {
			InputStream is = new FileInputStream("coucou.properties");
			OutputStream os = new FileOutputStream("coucou.xml");
			try {
				Properties p = new Properties();
				p.load(is);
				for (Object key : p.keySet()) {
					System.out.println(key + " = " + p.getProperty((String) key));
				}
				p.storeToXML(os, "My comment");
			} finally {
				is.close();
				os.close();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}
